// 验证规则
const [uname, ucard, dwname, daddress, xaddress, demail, personname, personphone] = [
  [
    {required: true, message: '请填写真实姓名'},
    {min: 2, max: 12, message: '姓名长度为2-12'},
  ],
  [
    {required: true, message: '请填写身份证号'},
    {pattern: /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/, message: '身份证格式不正确'}
  ],
  [
    {required: true, message: '请填写单位名称'},
    {min: 2, max: 30, message: '单位名称长度为2-30'},
  ],
  [
    {required: true, message: '请填写单位地址'},
    {min: 2, max: 50, message: '单位地址长度为2-50'},
  ],
  [
    {required: true, message: '请填写现居地址'},
    {min: 2, max: 50, message: '现居地址长度为2-50'},
  ],
  [
    {required: true, message: '请填写电子邮箱'},
	{
		type: 'email',
		transform(value) {
			return value.trim();
		},
		message: '电子邮箱格式不正确',
	},
  ],
  [
    {required: true, message: '请填写紧急联系人姓名'},
    {min: 2, max: 12, message: '紧急联系人姓名长度为2-12'},
  ],
  [
    {required: true, message: '请填写紧急联系人手机号'},
    {pattern: /^1[3456789]\d{9}$/, message: '紧急联系人手机号格式不正确'}
  ],
];

// 验证场景
const scene = {
  updateUcard: {uname, ucard},
  updateInfo: {dwname, daddress, xaddress, demail, personname, personphone}
};

export default scene;
